import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';

import 'package:get/get.dart';
import 'package:smart_translator/app/services/AudioService.dart';
import 'package:smart_translator/app/style/widget_style.dart';
import 'package:smart_translator/app/views/controller/MineViewController.dart';
import 'package:smart_translator/app/widgets/CommonWidgets.dart';

import '../../routes/app_pages.dart';
import '../../widgets/AppHeader.dart';

class MineViewView extends GetView<MineViewController> {
   MineViewView({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Obx(()=>
          SingleChildScrollView(
            child: Stack(
              children: [
                Container(
                  child: SvgPicture.asset(
                    "assets/images/header_part_bg.svg",
                    width: Get.width,
                  ),
                ),
                AppHeader.obtainHeaderForMine(controller.realname.value,controller.email.value,controller.id.value,controller.phone.value,controller.avatar.value,controller.localAvatar),
                Container(
                  width: Get.width,
                  margin: EdgeInsets.only(top: 100.h),
                  padding: EdgeInsets.all(20.w),
                  child: Column(
                    children: [
                      Container(
                        width: Get.width,
                        height: 85.h,
                        decoration: BoxDecoration(
                          boxShadow: [
                            CommonWidgets.getBoxShadow(),
                          ],
                          color: Colors.blueAccent,
                          borderRadius: BorderRadius.circular(
                            8,
                          ), // Optional: add border radius
                        ),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: [
                            InkWell(
                              onTap: () {
                                 //Navigator.push(context, MaterialPageRoute(builder: (context) => IsolateDemo()));
                                 // controller.isolateSendPort!.send(100);
                              },
                              child: Text(
                                'VIP 广告位',
                                style: TextStyle(
                                  color: Colors.white,
                                  fontSize: 16.sp,
                                  fontWeight: FontWeight.w900,
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),
                      SizedBox(height: 16.h),
                      Container(
                        width: Get.width,
                        padding: EdgeInsets.all(18.w),
                        decoration: BoxDecoration(
                          boxShadow: [
                            CommonWidgets.getBoxShadow(),
                          ],
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(
                            8,
                          ), // Optional: add border radius
                        ),
                        child: Column(
                          children: [
                            InkWell(
                              onTap: () {
                                Get.toNamed(Routes.OFFLINE_MODELS);
                              },
                              child: Container(
                                color: Colors.blueAccent.withValues(alpha: 0),
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: [
                                    Row(
                                      children: [
                                        Image.asset(
                                          'assets/images/icon_mine_offline_model.png',
                                          width: 24.w,
                                          height: 24.h,
                                        ),
                                        SizedBox(width: 10.w),
                                        Text(
                                          '离线模型',
                                          style:
                                          AppStyleThemeData.BUTTON_TEXT_STYLE,
                                        ),
                                      ],
                                    ),
                                    Image.asset(
                                      'assets/images/icon_mine_right_item.png',
                                      width: 24.w,
                                      height: 24.h,
                                    ),
                                  ],
                                ),
                              ),
                            ),
                            SizedBox(height: 12.h),
                            CommonWidgets.getMyDivider(),
                            SizedBox(height: 12.h),
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Row(
                                  children: [
                                    Image.asset(
                                      'assets/images/icon_mine_operation_guidline.png',
                                      width: 24.w,
                                      height: 24.h,
                                    ),
                                    SizedBox(width: 10.w),
                                    InkWell(
                                      onTap: () {
                                        Get.toNamed(Routes.NO_FOUND_DEVICE);
                                      },
                                      child: Text(
                                        '操作指引',
                                        style: AppStyleThemeData.BUTTON_TEXT_STYLE,
                                      ),
                                    ),
                                  ],
                                ),
                                Image.asset(
                                  'assets/images/icon_mine_right_item.png',
                                  width: 24.w,
                                  height: 24.h,
                                ),
                              ],
                            ),
                            SizedBox(height: 12.h),
                            CommonWidgets.getMyDivider(),
                            SizedBox(height: 12.h),
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Row(
                                  children: [
                                    Image.asset(
                                      'assets/images/icon_mine_lan_setting.png',
                                      width: 24.w,
                                      height: 24.h,
                                    ),
                                    SizedBox(width: 10.w),
                                    Text(
                                      '语言设置',
                                      style: AppStyleThemeData.BUTTON_TEXT_STYLE,
                                    ),
                                  ],
                                ),

                                Row(
                                  children: [
                                    Text(
                                      '简体中文',
                                      style: AppStyleThemeData.HINT_TEXT_STYLE,
                                    ),
                                    Image.asset(
                                      'assets/images/icon_mine_right_item.png',
                                      width: 24.w,
                                      height: 24.h,
                                    ),
                                  ],
                                ),
                              ],
                            ),
                            SizedBox(height: 12.h),
                            CommonWidgets.getMyDivider(),
                            SizedBox(height: 12.h),
                            InkWell(
                              onTap: () {
                                Get.toNamed(Routes.ABOUT_US);
                              },
                              child: Container(
                                color: Colors.blueAccent.withValues(alpha: 0),
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: [
                                    Row(
                                      children: [
                                        Image.asset(
                                          'assets/images/icon_mine_about_me.png',
                                          width: 24.w,
                                          height: 24.h,
                                        ),
                                        SizedBox(width: 10.w),
                                        Text(
                                          '关于',
                                          style:
                                          AppStyleThemeData.BUTTON_TEXT_STYLE,
                                        ),
                                      ],
                                    ),
                                    Row(
                                      children: [
                                        Text(
                                          '${controller.appVersion.value}',
                                          style: AppStyleThemeData.HINT_TEXT_STYLE,
                                        ),
                                        Image.asset(
                                          'assets/images/icon_mine_right_item.png',
                                          width: 24.w,
                                          height: 24.h,
                                        ),
                                      ],
                                    ),
                                  ],
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),
                      SizedBox(height: 130.h,),
                      Text('${controller.audioService.showLogText.value}')
                    ],
                  ),
                ),
              ],
            ),
          ),
      )
    );
  }
}
